<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<title></title>
<script type="text/javascript">
    function myFun(){
        var w=window.outerWidth;
        var h=window.outerHeight;
        var txt="窗口大小: 宽度=" + w + ", 高度=" + h;
        document.getElementById("demo").innerHTML=txt;
    }
</script>
</head>
<body onresize="myFun()">
<p id="demo"></p>
</body>
</html>
